import copy
from .fpn import FPN
from .pan import PAN
from .bifpn import BiFPN
from .fpn_slim import FPN_Slim
from .pan_slim import PAN_Slim
from .tan import TAN
from .TFF import TFF
from .FPN_Transformer import FPN_Transformer
# from .swin_fpn import TAN
from .fpn_at import FPN_AT
from .bfp import BFP
from .fpn_ea import FPN_EA
from .TFF_O import TFF_O
def build_fpn(cfg):
    fpn_cfg = copy.deepcopy(cfg)
    name = fpn_cfg.pop('name')
    if name == 'FPN':
        return FPN(**fpn_cfg)
    elif name == 'PAN':
        return PAN(**fpn_cfg)
    elif name == 'BiFPN':
        return BiFPN(**fpn_cfg)
    elif name == 'FPN_Slim':
            return FPN_Slim(**fpn_cfg)
    elif name == 'PAN_Slim':
        return PAN_Slim(**fpn_cfg)
    elif name == "TAN":
        return TAN(**fpn_cfg)
    elif name == "FPN_AT":
        return FPN_AT(**fpn_cfg)
    elif name == "BFP":
        return BFP(**fpn_cfg)
    elif name == "FPN_EA":
        return FPN_EA(**fpn_cfg)
    elif name == 'TFF':
        return TFF(**fpn_cfg)
    elif name =='TFF_O':
        return TFF_O(**fpn_cfg)
    elif name =='FPN_Transformer':
        return FPN_Transformer(**fpn_cfg)
    else:
        raise NotImplementedError